package cn.itcast.order.origin.impl;

import cn.itcast.order.origin.RequestOriginParser;
import com.alibaba.cloud.commons.lang.StringUtils;

import javax.servlet.http.HttpServletRequest;

/**
 * @author zx
 * @date 2021/11/11 15:19
 */
public class HeaderOriginParserImpl implements RequestOriginParser {
    @Override
    public String parseOrigin(HttpServletRequest request) {
        // 1.获取请求头
        String origin = request.getHeader("origin");
        // 2.非空判断
        if (StringUtils.isEmpty(origin)) {
            origin = "blank";
        }
        return origin;
    }
}
